from .models import QuestionType,Question,Answer,Choice
from random import sample

class Cpaper():

    def __init__(self,paper_dict):
        self.paper_dict = paper_dict
        
    def c_paper(self):
        question_list = []
        question_dict = {}
        for key,value in eval(self.paper_dict).copy().items():
            qu_type = QuestionType.objects.get(question_type = key)
            for question_id in value[2][:]:        
                question_obj = qu_type.question_set.get(pk = question_id)
                question_list.append(question_obj)
            value[2][:] = question_list
            question_dict[key] = value
            question_list = []

        return question_dict

            
            
